<?php

/**
 * wixet actions.
 *
 * @package    sfwixet
 * @subpackage wixet
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class wixetActions extends sfActions
{
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
  public function executeIndex(sfWebRequest $request)
  {
    $this->forward('default', 'module');
  }
  
  public function executeUserList(sfWebRequest $request)
  {
  	$users = Doctrine::getTable("sfGuardUser")->findAll();
  	echo json_encode($users->toArray());
    return sfView::NONE;
  }
  
  public function executeFontList(sfWebRequest $request)
  {
  	$fonts = Doctrine::getTable("font")->findAll();
  	echo json_encode(array("error"=>false,"fontList"=>$fonts->toArray()));
    return sfView::NONE;
  }
  
  public function executeCityList(sfWebRequest $request)
  {
  	try{
  		$cityList = Doctrine::getTable("city")->findByCountryId($request->getParameter("country"));
  		echo json_encode(array("error"=>false,"cityList"=>$cityList->toArray()));
  	}catch(Exception $e){
  		echo json_encode(array("error"=>true,"message"=>$e->getMessage()));
  	}
    return sfView::NONE;
  }
  
  public function executeLanguageList(sfWebRequest $request)
  {
  	try{
  		echo json_encode(array("error"=>false,"languageList"=>Doctrine::getTable("language")->findAll()->toArray()));
  	}catch(Exception $e){
  		echo json_encode(array("error"=>true,"message"=>$e->getMessage()));
  	}
    return sfView::NONE;
  }
  
}
